import { 
    getBannerAPI,
    getCategoryAPI,
    getNewAPI,
    getHotAPI
} from "@/apis/layout"
import { defineStore } from "pinia"

const useCategoryStore = defineStore('category', {
    state: () => ({
        categoryList: [],
        bannerList: [],
        newList: [],
        hotList: [],
    }),
    actions: {
        async getCategory() {
            const res = await getCategoryAPI()
            this.categoryList = res.result
        },
        async  getBanner() {
            const res = await getBannerAPI()
            this.bannerList = res.result
        },
        async  getNew() {
            const res = await getNewAPI()
            this.newList = res.result
        },
        async  getHot() {
            const res = await getHotAPI()
            this.hotList = res.result
        }
    }
})

export default useCategoryStore